<h1>Listing pages</h1>

<p>Page index impressions: <%= Page.impressions_for_action('index') %></p>
<p>Page with most impressions: <%= Page.most_impressions.first.title if Page.most_impressions.first %></p>
<p>Page with most unique impressions: <%= Page.most_unique_impressions.first.title if Page.most_unique_impressions.first %></p>
<p>Page new impressions: <%= Page.impressions_for_action('new') %></p>
<p>Page show impressions: <%= Page.impressions_for_action('show') %></p>

<table>
  <tr>
    <th>Title</th>
    <th>Body</th>
    <th>Impression Count</th>
    <th>Unique Impression Count</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @pages.each do |page| %>
  <tr>
    <td><%= page.title %></td>
    <td><%= page.body %></td>
    <td><%= page.impression_count %></td>
    <td><%= page.unique_impression_count %></td>
    <td><%= link_to 'Show', page %></td>
    <td><%= link_to 'Edit', edit_page_path(page) %></td>
    <td><%= link_to 'Destroy', page, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Page', new_page_path %>
